package demo
{
	
	import demo.componet.ani.RolePlayer;
	import demo.componet.list.GListItem;
	import demo.componet.progress.GProgressBar0;
	import demo.componet.progress.GProgressBarBase;
	
	import laya.display.Sprite;
	import laya.display.Text;
	import laya.events.Event;
	import laya.html.dom.HTMLDivElement;
	import laya.maths.MathUtil;
	import laya.ui.Clip;
	import laya.ui.ComboBox;
	import laya.ui.HSlider;
	import laya.ui.Label;
	import laya.ui.List;
	import laya.ui.ProgressBar;
	import laya.ui.Tree;
	import laya.utils.Handler;
	import laya.utils.Pool;
	
	/**
	 *@date 2017-2-16 上午9:43:42
	 *@author zhouhonghui
	 */
	public class UIDemor extends Sprite
	{

		private var hslider:HSlider;
		public function UIDemor()
		{
			super();
			initUI();
		}
		
		private function initUI():void
		{
			var n:int = 0;
			for (var j:int = 0; j < n; j++) 
			{
				var an:RolePlayer = new RolePlayer();
				addChild(an);
				an.autoPlay = true;				
				an.pos(Math.random()*-500,Math.random()*-200);
			}
			Laya.timer.loop(1000,this,function ():void{
			});
			var sp:Sprite = new Sprite();
		
			var clip:Clip = new Clip('comp/clip_num.png');
			//clip.graphics.drawTexture(Laya.loader.getRes('comp/clip_num.png'));
			clip.clipX = 10; //横线分割数量
			clip.index = 1;
			clip.pos(120,30);
			addChild(clip);
			
			
			var bar:ProgressBar = new GProgressBar0();
			//bar.sizeGrid = "15,40,15,40,0";
			bar.skin = "comp/progress_big.png";
			bar.pos(clip.x,50);
			bar.width = 200;
			bar.value = 0.5;
			addChild(bar);
			
			var cbb:ComboBox = new ComboBox(); //下拉菜单
			cbb.pos(clip.x,bar.y+bar.height);
			cbb.skin = "comp/combobox.png";
			cbb.labels="物品,装备,药品,坐骑,翅膀,神器";
			cbb.visibleNum = 3;
			cbb.scrollBarSkin = "comp/vscroll.png";
			cbb.selectedIndex = 0;
			addChild(cbb);
			
			hslider = new HSlider();
			hslider.skin = "comp/hslider.png";
			hslider.pos(clip.x,cbb.y+cbb.height+10);
			hslider.changeHandler = Handler.create(this,onHSliderHandler);
			addChild(hslider);
			hslider.on(Event.CHANGE,this,onHSlider);
			
			var scoreHtml:HTMLDivElement = new HTMLDivElement();			
			scoreHtml.style.align = "middle";			
			scoreHtml.innerHTML = "<span color='#ff0000' >HTMLDivElement 你好</span><img src='comp/face.png'></img>"
			scoreHtml.height =scoreHtml.contextHeight+20;
			addChild(scoreHtml);
			
			var lst:List = new List();			
			lst.itemRender = GListItem;
			lst.repeatX = 3;// 列
			lst.repeatY = 3;// 行
			lst.spaceX = 50;
			lst.spaceY = 30;
			lst.vScrollBarSkin = "comp/vscroll.png";
			var arr:Array = [];
			for (var i:int = 0; i < 15; i++) 
			{
				arr.push({label:"Item"+(i+1)});
			}			
			lst.width=150;
			lst.height = 75;
			lst.dataSource = arr;
			addChild(lst);
			lst.pos(clip.x,hslider.y+hslider.height+20);
			
			var tree:Tree = new Tree();
			addChild(tree);
			
			//扩展模块
			
						
			
		} 
		
		private function onHSliderHandler(val:Number):void
		{
			trace("onHSliderHandler val =",val);
		}
		
		private function onHSlider(e:*=null):void
		{
			//trace('onHSlider hslider.value=',hslider.value)
		}
		
	}
}